Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add empty value check in getRequestBodyExamples() #904

Merged
merged 6 commits into from
Sep 13, 2024

Conversation

darrenyong
Copy link
Contributor

🚥 Resolves ISSUE_ID

🧰 Changes

There is a weird case in our main repo where we initialize Webhooks with an empty requestBodyExamples with the following structure:

requestBodyExamples: [
  {
    mediaType: 'application/json',
    examples: [{
      value: undefined
    }],
  },
];

This causes Operation.getRequestBodyExamples() to return with an empty request example even though we should be creating an example for them. This adds an extra check so that we avoid returning the empty example and proceed to the subsequent getRequestBodyExamples() call that generates an example for the user.

🧬 QA & Testing

Provide as much information as you can on how to test what you've done.

@darrenyong darrenyong marked this pull request as ready for review September 12, 2024 21:21
@erunion erunion requested review from a team, erunion and kanadgupta and removed request for a team September 12, 2024 21:24
@erunion erunion added the bug Something isn't working label Sep 12, 2024
Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoa incredible find here 🫨 small suggestion to account for a potential edge case but overall happy with this!

Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small test renaming suggestion, otherwise LGTM!

@darrenyong darrenyong requested review from erunion and removed request for erunion September 13, 2024 21:46
@darrenyong darrenyong dismissed erunion’s stale review September 13, 2024 22:09

still asks for changes even though changes were made

@darrenyong darrenyong merged commit dcb7ab6 into main Sep 13, 2024
6 checks passed
@darrenyong darrenyong deleted the darren/getRequestBodyExamples-empty-value-check branch September 13, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants